﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/site.master" CodeBehind="search_leaf.aspx.cs" Inherits="Icst.Leaflike.Web.search.leaf" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit"%>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="main">
    <!--#include file="search_head.htm"--> 
    
   <form id="mainform" runat="server" enctype="multipart/form-data">
   <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" />
    <div style="margin-top:10px; margin-bottom:10px">
    <div>
        <div class="optionbar">
            <span><strong>树叶选项</strong></span>
            <input id="selectLink" runat="server" name="link" type="radio" onclick="selectSelect()" checked="true" /><label for="selectLink">选择叶形</label>
            <input id="uploadLink" runat="server" name="link" type="radio" href="javascript:" onclick="selectUpad()" /><label for="uploadLink">上传图片</label>
        </div>
        <asp:HiddenField ID="yeziValue" runat="server" />
        <div id="uploadDiv" runat="server" style="margin-bottom:10px; display:none">
             <asp:FileUpload ID="treeUploader" runat="server"/>&nbsp;&nbsp;
             <asp:Button ID="saveButton" runat="server" Text="上传" OnClick="saveButton_Click" OnClientClick="return startUpload();" />
             <asp:OptionSelector ID="yeziselector" runat="server" Group="yezi" Title="" OnClientClick="selectYezi(this)" />
        </div>
        <div id="selectDiv" runat="server" style="margin-bottom:10px;">
            <asp:OptionSelector ID="yexingSelector" runat="server" Group="yexing" Title="" />
         </div>
        <script type="text/javascript">
            var uploadDiv = "<%=uploadDiv.ClientID%>";
            var selectDiv = "<%=selectDiv.ClientID%>";
            var selectLink = "<%=selectLink.ClientID%>";
            var uploadLink = "<%=uploadLink.ClientID%>";
            var yeziValue = "<%=yeziValue.ClientID%>";
            var treeUploader = "<%=treeUploader.ClientID%>";            
            var EXTMESSAGE = "jpg或jpeg或gif";
            function selectSelect() {
                document.getElementById(uploadDiv).style.display = "none";
                document.getElementById(selectDiv).style.display = "";
            }
            function selectUpad() {
                document.getElementById(uploadDiv).style.display = "";
                document.getElementById(selectDiv).style.display = "none";
            }
            function getExt(file_Name, exet) {
                if (file_Name.substr(file_Name.lastIndexOf(".") + 1).toLowerCase() != exet) { return false; }
                else { return true; }
            }
            function startUpload(sender, args) {
                var arg = document.getElementById(treeUploader);
                var valid = getExt(arg.value, "jpg");
                valid = valid || getExt(arg.value, "jpeg");
                valid = valid || getExt(arg.value, "gif");
                if (valid == false) {
                    alert("只能接收" + EXTMESSAGE + "格式"); 
                    return false; 
                }

//                if (a == true) {
//                    //$("#div_Status").html("文件<font color=\"red\">" + args.get_fileName() + "</font>正在上传，请稍等").append($("<img></img>").attr({ "src": "image/loading.gif", "id": "div_Loading" }));
//                }
                return valid;
            }
            function selectYezi(obj) {
                document.getElementById(yeziValue).value = obj.value;
            }
        </script>
    </div>
    
    <asp:OptionSelector ID="yejianSelector" runat="server" Group="yejian" Title="叶尖选项" />
    <asp:OptionSelector ID="yejiSelector" runat="server" Group="yeji" Title="叶基选项" />
    <asp:OptionSelector ID="yeyuanSelector" runat="server" Group="yeyuan" Title="页缘选项" />
    </div>
    <ul class="menutabs">
        <li><a href='<%="search_branch.htm?" + SearchQuery.ToString()%>'>上一步</a></li>
        <li><asp:LinkButton ID="LinkButton1" runat="server" Text="确认" OnClick="nextButton_Click"/></li>
        <li><asp:LinkButton ID="LinkButton2" runat="server" Text="跳过" OnClick="ignoreButton_Click"/></li>
    </ul>
</form>
</asp:Content>